package cn.edu.scau.cmi.suyaoxing.singleton;

public class Marshel {
	private static Marshel marshel[]=new Marshel[10];
	private static int count=0;
	private static final int N=10;
	private int no;
	private Marshel(int no) {
		this.no=no;
	}
	public int getNo() {
		return no;
	}
	public void setNo(int no) {
		this.no=no;
	}
	static {
			while(count<N) {
				marshel[count]=new Marshel(count+1);
				System.out.println("已创建元帅"+marshel[count].no);
				count++;
			}
		}
	public static String getRandomInstance() {
		int num=(int)(Math.random()*N);
		return "元帅"+marshel[num].getNo();
	}	
}
